From 72686f0f7699b6b0b034e46148ff415dee0e6954 Mon Sep 17 00:00:00 2001 From: OV2 Date: Tue, 7 Aug 2018 16:03:41 +0200 Subject: [PATCH] win32: get rid of some warnings --- win32/CD3DCG.cpp | 12 ++++++------ win32/CDirect3D.h | 2 +- win32/CGLCG.cpp | 30 +++++++++++++++--------------- win32/wsnes9x.cpp | 1 - 4 files changed, 22 insertions(+), 23 deletions(-) diff --git a/win32/CD3DCG.cpp b/win32/CD3DCG.cpp index b9a65b48..d0eeaabe 100644 --- a/win32/CD3DCG.cpp +++ b/win32/CD3DCG.cpp @@ -427,7 +427,7 @@ void CD3DCG::ensureTextureSize(LPDIRECT3DTEXTURE9 &tex, XMFLOAT2 &texSize, tex->Release(); hr = pDevice->CreateTexture( - wantedSize.x, wantedSize.y, + (UINT)wantedSize.x, (UINT)wantedSize.y, 1, // 1 level, no mipmaps renderTarget?D3DUSAGE_RENDERTARGET:0, renderTarget?(useFloat?D3DFMT_A32B32G32R32F:D3DFMT_A8R8G8B8):D3DFMT_R5G6B5, @@ -568,7 +568,7 @@ void CD3DCG::Render(LPDIRECT3DTEXTURE9 &origTex, XMFLOAT2 textureSize, /* viewport defines output size */ - setViewport(0,0,shaderPasses[i].outputSize.x,shaderPasses[i].outputSize.y); + setViewport(0,0,(DWORD)shaderPasses[i].outputSize.x, (DWORD)shaderPasses[i].outputSize.y); pDevice->Clear(0, NULL, D3DCLEAR_TARGET, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0); @@ -605,11 +605,11 @@ void CD3DCG::Render(LPDIRECT3DTEXTURE9 &origTex, XMFLOAT2 textureSize, pDevice->SetTexture(0, shaderPasses.back().tex); pDevice->SetRenderTarget(0,pBackBuffer); pBackBuffer->Release(); - RECT displayRect=CalculateDisplayRect(shaderPasses.back().outputSize.x,shaderPasses.back().outputSize.y,windowSize.x,windowSize.y); + RECT displayRect=CalculateDisplayRect((unsigned int)shaderPasses.back().outputSize.x, (unsigned int)shaderPasses.back().outputSize.y, (unsigned int)windowSize.x, (unsigned int)windowSize.y); setViewport(displayRect.left,displayRect.top,displayRect.right - displayRect.left,displayRect.bottom - displayRect.top); setVertexStream(shaderPasses.back().vertexBuffer, shaderPasses.back().outputSize,shaderPasses.back().textureSize, - XMFLOAT2(displayRect.right - displayRect.left,displayRect.bottom - displayRect.top)); + XMFLOAT2((float)(displayRect.right - displayRect.left),(float)(displayRect.bottom - displayRect.top))); pDevice->SetVertexShader(NULL); pDevice->SetPixelShader(NULL); } @@ -696,7 +696,7 @@ void CD3DCG::setShaderVars(int pass) setProgramUniform(pass,"IN.video_size",&inputSize); setProgramUniform(pass,"IN.texture_size",&textureSize); setProgramUniform(pass,"IN.output_size",&outputSize); - float shaderFrameCnt = frameCnt; + float shaderFrameCnt = (float)frameCnt; if(shaderPasses[pass].frameCounterMod) shaderFrameCnt = (float)(frameCnt % shaderPasses[pass].frameCounterMod); setProgramUniform(pass,"IN.frame_count",&shaderFrameCnt); @@ -834,7 +834,7 @@ void CD3DCG::setupVertexDeclaration(shaderPass &pass) } } else { int resIndex = atoi(sem + strlen(sem) - 1); - D3DVERTEXELEMENT9 elem = {streamNum, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, resIndex}; + D3DVERTEXELEMENT9 elem = {(WORD)streamNum, 12, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, (BYTE)resIndex}; vElems[i] = elem; pass.parameterMap[i].streamNumber = streamNum; streamNum++; diff --git a/win32/CDirect3D.h b/win32/CDirect3D.h index 5af71d08..c7cc593b 100644 --- a/win32/CDirect3D.h +++ b/win32/CDirect3D.h @@ -216,7 +216,7 @@ typedef struct _VERTEX { } } VERTEX; //our custom vertex with a constuctor for easier assignment -enum current_d3d_shader_type { D3D_SHADER_NONE, D3D_SHADER_HLSL, D3D_SHADER_CG }; +enum current_d3d_shader_type { D3D_SHADER_NONE, D3D_SHADER_CG }; class CDirect3D: public IS9xDisplayOutput { diff --git a/win32/CGLCG.cpp b/win32/CGLCG.cpp index d7a5e538..f63a9b59 100644 --- a/win32/CGLCG.cpp +++ b/win32/CGLCG.cpp @@ -547,7 +547,7 @@ void CGLCG::Render(GLuint &origTex, xySize textureSize, xySize inputSize, xySize /* viewport determines the area we render into the output texture */ - glViewport(0,0,shaderPasses[i].outputSize.x,shaderPasses[i].outputSize.y); + glViewport(0,0,(GLsizei)shaderPasses[i].outputSize.x, (GLsizei)shaderPasses[i].outputSize.y); /* set up framebuffer and attach output texture */ @@ -601,7 +601,7 @@ void CGLCG::Render(GLuint &origTex, xySize textureSize, xySize inputSize, xySize memcpy(pass.texCoords,shaderPasses[1].texcoords,sizeof(pass.texCoords)); prevPasses.push_front(pass); glBindTexture(GL_TEXTURE_2D,origTex); - glTexImage2D(GL_TEXTURE_2D,0,GL_RGB,textureSize.x,textureSize.y,0,GL_RGB,GL_UNSIGNED_SHORT_5_6_5,NULL); + glTexImage2D(GL_TEXTURE_2D,0,GL_RGB, (GLsizei)textureSize.x, (GLsizei)textureSize.y,0,GL_RGB,GL_UNSIGNED_SHORT_5_6_5,NULL); /* bind output of last pass to be rendered on the backbuffer */ @@ -611,8 +611,8 @@ void CGLCG::Render(GLuint &origTex, xySize textureSize, xySize inputSize, xySize /* calculate and apply viewport and texture coordinates to that will be used in the main ogl code */ - RECT displayRect=CalculateDisplayRect(shaderPasses.back().outputSize.x,shaderPasses.back().outputSize.y,windowSize.x,windowSize.y); - glViewport(displayRect.left,windowSize.y-displayRect.bottom,displayRect.right-displayRect.left,displayRect.bottom-displayRect.top); + RECT displayRect=CalculateDisplayRect((unsigned int)shaderPasses.back().outputSize.x, (unsigned int)shaderPasses.back().outputSize.y, (unsigned int)windowSize.x, (unsigned int)windowSize.y); + glViewport(displayRect.left,(LONG)windowSize.y-displayRect.bottom,displayRect.right-displayRect.left,displayRect.bottom-displayRect.top); setTexCoords(shaderPasses.size()-1,shaderPasses.back().outputSize,shaderPasses.back().textureSize,true); /* render to backbuffer without shaders @@ -670,9 +670,9 @@ void CGLCG::setShaderVars(int pass) /* IN paramater */ - float inputSize[2] = {shaderPasses[pass-1].outputSize.x,shaderPasses[pass-1].outputSize.y}; - float textureSize[2] = {shaderPasses[pass-1].textureSize.x,shaderPasses[pass-1].textureSize.y}; - float outputSize[2] = {shaderPasses[pass].outputSize.x,shaderPasses[pass].outputSize.y}; + float inputSize[2] = { (float)shaderPasses[pass-1].outputSize.x, (float)shaderPasses[pass-1].outputSize.y }; + float textureSize[2] = { (float)shaderPasses[pass-1].textureSize.x, (float)shaderPasses[pass-1].textureSize.y }; + float outputSize[2] = { (float)shaderPasses[pass].outputSize.x, (float)shaderPasses[pass].outputSize.y }; setProgram2fv(pass,"IN.video_size",inputSize); setProgram2fv(pass,"IN.texture_size",textureSize); @@ -685,8 +685,8 @@ void CGLCG::setShaderVars(int pass) /* ORIG parameter */ - float orig_videoSize[2] = {shaderPasses[0].outputSize.x,shaderPasses[0].outputSize.y}; - float orig_textureSize[2] = {shaderPasses[0].textureSize.x,shaderPasses[0].textureSize.y}; + float orig_videoSize[2] = { (float)shaderPasses[0].outputSize.x, (float)shaderPasses[0].outputSize.y }; + float orig_textureSize[2] = { (float)shaderPasses[0].textureSize.x, (float)shaderPasses[0].textureSize.y }; setProgram2fv(pass,"ORIG.video_size",orig_videoSize); setProgram2fv(pass,"ORIG.texture_size",orig_textureSize); @@ -696,8 +696,8 @@ void CGLCG::setShaderVars(int pass) /* PREV parameter */ if(prevPasses[0].textureSize.x>0) { - float prev_videoSize[2] = {prevPasses[0].videoSize.x,prevPasses[0].videoSize.y}; - float prev_textureSize[2] = {prevPasses[0].textureSize.x,prevPasses[0].textureSize.y}; + float prev_videoSize[2] = { (float)prevPasses[0].videoSize.x, (float)prevPasses[0].videoSize.y }; + float prev_textureSize[2] = { (float)prevPasses[0].textureSize.x, (float)prevPasses[0].textureSize.y }; setProgram2fv(pass,"PREV.video_size",prev_videoSize); setProgram2fv(pass,"PREV.texture_size",prev_textureSize); @@ -711,8 +711,8 @@ void CGLCG::setShaderVars(int pass) if(prevPasses[i].textureSize.x==0) break; char varname[100]; - float prev_videoSize[2] = {prevPasses[i].videoSize.x,prevPasses[i].videoSize.y}; - float prev_textureSize[2] = {prevPasses[i].textureSize.x,prevPasses[i].textureSize.y}; + float prev_videoSize[2] = { (float)prevPasses[i].videoSize.x, (float)prevPasses[i].videoSize.y }; + float prev_textureSize[2] = { (float)prevPasses[i].textureSize.x, (float)prevPasses[i].textureSize.y }; sprintf(varname,"PREV%d.video_size",i); setProgram2fv(pass,varname,prev_videoSize); sprintf(varname,"PREV%d.texture_size",i); @@ -734,8 +734,8 @@ void CGLCG::setShaderVars(int pass) if(pass>2) { for(int i=1;i