diff --git a/src/gpu/renderer.cpp b/src/gpu/renderer.cpp
index 742f96ff..d5ffe221 100644
--- a/src/gpu/renderer.cpp
+++ b/src/gpu/renderer.cpp
@@ -114,9 +114,9 @@ Renderer::Renderer(ivec2 size)
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE;
- HRESULT hr = VideoData::d3d_ctx->CreateDevice(0, D3DDEVTYPE_HAL, g_hwnd,
- D3DCREATE_HARDWARE_VERTEXPROCESSING,
- &d3dpp, &m_data->m_d3d_dev);
+ HRESULT hr = m_data->m_d3d_ctx->CreateDevice(0, D3DDEVTYPE_HAL, g_hwnd,
+ D3DCREATE_HARDWARE_VERTEXPROCESSING,
+ &d3dpp, &m_data->m_d3d_dev);
if (FAILED(hr))
{
Log::Error("cannot create D3D device\n");
@@ -157,7 +157,7 @@ Renderer::Renderer(ivec2 size)
SetDepthFunc(DepthFunc::LessOrEqual);
m_data->m_cull_mode = CullMode::Disabled;
- SetCullMode(CullMode::CounterClockwise);
+ SetCullMode(CullMode::Clockwise);
m_data->m_polygon_mode = PolygonMode::Point;
SetPolygonMode(PolygonMode::Fill);
@@ -204,8 +204,8 @@ void Renderer::Clear(ClearMask mask)
vec3 tmp = 255.999f * GetClearColor().rgb;
D3DCOLOR clear_color = D3DCOLOR_XRGB((int)tmp.r, (int)tmp.g, (int)tmp.b);
- if (FAILED(VideoData::d3d_dev->Clear(0, nullptr, m, clear_color,
- g_renderer->GetClearDepth(), 0)))
+ if (FAILED(m_data->m_d3d_dev->Clear(0, nullptr, m, clear_color,
+ GetClearDepth(), 0)))
Abort();
#else
GLbitfield m = 0;
@@ -398,7 +398,7 @@ void Renderer::SetBlendFunc(BlendFunc src, BlendFunc dst)
return;
#if defined USE_D3D9 || defined _XBOX
- enum D3DBLEND s1[2] = { D3DBLEND_ONE, D3DBLEND_ZERO };
+ D3DBLEND s1[2] = { D3DBLEND_ONE, D3DBLEND_ZERO };
BlendFunc s2[2] = { src, dst };
for (int i = 0; i < 2; ++i)
@@ -429,16 +429,16 @@ void Renderer::SetBlendFunc(BlendFunc src, BlendFunc dst)
s1[i] = D3DBLEND_INVDESTALPHA; break;
/* FiXME: these can be supported using D3DPBLENDCAPS_BLENDFACTOR */
case BlendFunc::ConstantColor:
- assert(0, "BlendFunc::ConstantColor not supported");
+ ASSERT(0, "BlendFunc::ConstantColor not supported");
break;
case BlendFunc::OneMinusConstantColor:
- assert(0, "BlendFunc::OneMinusConstantColor not supported");
+ ASSERT(0, "BlendFunc::OneMinusConstantColor not supported");
break;
case BlendFunc::ConstantAlpha:
- assert(0, "BlendFunc::ConstantAlpha not supported");
+ ASSERT(0, "BlendFunc::ConstantAlpha not supported");
break;
case BlendFunc::OneMinusConstantAlpha:
- assert(0, "BlendFunc::OneMinusConstantAlpha not supported");
+ ASSERT(0, "BlendFunc::OneMinusConstantAlpha not supported");
break;
}
}
@@ -630,12 +630,12 @@ void Renderer::SetCullMode(CullMode mode)
break;
case CullMode::Clockwise:
glEnable(GL_CULL_FACE);
- glCullFace(GL_BACK);
+ glCullFace(GL_FRONT);
glFrontFace(GL_CW);
break;
case CullMode::CounterClockwise:
glEnable(GL_CULL_FACE);
- glCullFace(GL_BACK);
+ glCullFace(GL_FRONT);
glFrontFace(GL_CCW);
break;
}
@@ -668,7 +668,7 @@ void Renderer::SetPolygonMode(PolygonMode mode)
m_data->m_d3d_dev->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME);
break;
case PolygonMode::Fill:
- m_data->m_d3d_dev->SetRenderState(D3DRS_FILLMODE, D3DCULL_SOLID);
+ m_data->m_d3d_dev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
break;
}
#elif defined __CELLOS_LV2__ || defined GL_VERSION_1_1
diff --git a/src/gpu/texture.cpp b/src/gpu/texture.cpp
index 6b143b00..c03ff417 100644
--- a/src/gpu/texture.cpp
+++ b/src/gpu/texture.cpp
@@ -90,7 +90,7 @@ Texture::Texture(ivec2 size, PixelFormat format)
/* FIXME: this is all mixed up for the RGBA/ARGB combinations */
# if defined USE_D3D9
{ D3DFMT_R8G8B8, 3 }, /* RGB_8 */
- { D3DFMT_UNKNOWN, 0 }, /* RGBA_8 */
+ { D3DFMT_A8R8G8B8, 4 }, /* RGBA_8 */
{ D3DFMT_A8R8G8B8, 4 }, /* ARGB_8 */
{ D3DFMT_UNKNOWN, 0 }, /* ABGR_8 */
{ D3DFMT_L8, 1 }, /* Y8 */
@@ -105,6 +105,8 @@ Texture::Texture(ivec2 size, PixelFormat format)
};
D3DFORMAT d3d_format = GET_CLAMPED(d3d_formats, format).format;
+ ASSERT(d3d_format != D3DFMT_UNKNOWN,
+ "unsupported texture format %d\n", format);
# if defined USE_D3D9
int d3d_usage = D3DUSAGE_DYNAMIC;
# else
@@ -112,8 +114,8 @@ Texture::Texture(ivec2 size, PixelFormat format)
# endif
m_data->m_dev->CreateTexture(m_data->m_size.x, m_data->m_size.y, 1,
- d3d_usage, d3d_format,
- D3DPOOL_DEFAULT, &m_data->m_texture, nullptr);
+ d3d_usage, d3d_format,
+ D3DPOOL_DEFAULT, &m_data->m_texture, nullptr);
m_data->m_bytes_per_elem = GET_CLAMPED(d3d_formats, format).bytes;
#else
static struct
diff --git a/src/lol/gpu/renderer.h b/src/lol/gpu/renderer.h
index 6454c43f..7c428802 100644
--- a/src/lol/gpu/renderer.h
+++ b/src/lol/gpu/renderer.h
@@ -154,11 +154,11 @@ private:
Renderer(ivec2 size);
~Renderer();
- void *GetDevice();
-
public:
void Clear(ClearMask mask);
+ void *GetDevice();
+
public:
void SetViewport(ibox2 viewport);
ibox2 GetViewport() const;
diff --git a/src/lolcore.vcxproj b/src/lolcore.vcxproj
index 3fbf14cb..4ebaf42f 100644
--- a/src/lolcore.vcxproj
+++ b/src/lolcore.vcxproj
@@ -1,299 +1,298 @@
-
-
-
-
- Debug
- PS3
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Debug
- Xbox 360
-
-
- Release
- PS3
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
- Release
- Xbox 360
-
-
-
- {9E62F2FE-3408-4EAE-8238-FD84238CEEDA}
- StaticLibrary
- Win32Proj
-
-
-
- true
- MultiByte
-
-
- true
- MultiByte
-
-
- MultiByte
-
-
- MultiByte
-
-
- false
- true
- MultiByte
-
-
- false
- true
- MultiByte
-
-
- true
- MultiByte
-
-
- true
- MultiByte
-
-
-
-
-
-
-
-
-
-
-
-
- _LIB;%(PreprocessorDefinitions)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {83d3b207-c601-4025-8f41-01dedc354661}
-
-
- {d84021ca-b233-4e0f-8a52-071b83bbccc4}
-
-
-
-
-
-
-
+
+
+
+
+ Debug
+ PS3
+
+
+ Debug
+ Win32
+
+
+ Debug
+ x64
+
+
+ Debug
+ Xbox 360
+
+
+ Release
+ PS3
+
+
+ Release
+ Win32
+
+
+ Release
+ x64
+
+
+ Release
+ Xbox 360
+
+
+
+ {9E62F2FE-3408-4EAE-8238-FD84238CEEDA}
+ StaticLibrary
+ Win32Proj
+
+
+
+ true
+ MultiByte
+
+
+ true
+ MultiByte
+
+
+ MultiByte
+
+
+ MultiByte
+
+
+ false
+ true
+ MultiByte
+
+
+ false
+ true
+ MultiByte
+
+
+ true
+ MultiByte
+
+
+ true
+ MultiByte
+
+
+
+
+
+
+
+
+
+
+
+
+ _LIB;%(PreprocessorDefinitions)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {83d3b207-c601-4025-8f41-01dedc354661}
+
+
+ {d84021ca-b233-4e0f-8a52-071b83bbccc4}
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/lolcore.vcxproj.filters b/src/lolcore.vcxproj.filters
index 6bee23b6..565d851f 100644
--- a/src/lolcore.vcxproj.filters
+++ b/src/lolcore.vcxproj.filters
@@ -76,6 +76,9 @@
{1d945673-ee9a-48a7-9ee8-34338c5fefc1}
+
+ {01285b11-c6c7-4a9e-8dee-daa2c63901e4}
+
@@ -306,11 +309,11 @@
base
+
+ debug
+
-
- image
-
debug
@@ -596,6 +599,15 @@
sys
+
+ lol\debug
+
+
+ lol\debug
+
+
+ lol\image
+
@@ -649,4 +661,4 @@
gpu
-
+
\ No newline at end of file